<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>单词</title>
    <meta
            content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"
            name="viewport">
    <link rel="stylesheet" href="/static/plugins/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/static/plugins/adminLTE/css/AdminLTE.css">
    <link rel="stylesheet"
          href="/static/plugins/adminLTE/css/skins/_all-skins.min.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <script src="/static/plugins/jQuery/jquery-2.2.3.min.js"></script>
    <script src="/static/plugins/bootstrap/js/bootstrap.min.js"></script>

    <script src="/static/plugins/angularjs/angular.min.js"></script>

    <script type="text/javascript" src="/static/js/base.js"></script>
    <script type="text/javascript" src="/static/js/service/brandService.js"></script>
    <script type="text/javascript" src="/static/js/controller/baseController.js"></script>
    <script type="text/javascript" src="/static/js/controller/brandController.js"></script>
    <script type="text/javascript" src="/static/js/aes.js"></script>

    <script type="text/javascript" src="/static/js/jquery-1.8.2.js"></script>
    <script type="text/javascript">
        function check(){
            var word = $("#word").val();
            var reg = /^([a-z]|[A-Z])+$/
            if(!reg.test(word)){
                $("#aaa").empty();
                $("#aaa").append("单词不匹配");
                a = false;
                $("#word").val('');
                return;
            }else{
                $("#aaa").empty();
                $.post(
                        "../word/checkWord",
                        {word:word},
                        function(obj){
                            if(obj){
                            }else{
                                $("#aaa").empty();
                                $("#aaa").append("已存在");
                                /* $("#word").val(''); */
                            }
                        }
                )
            }

        }
    </script>
</head>
<body class="hold-transition skin-red sidebar-mini" ng-app="pinyougou"
      ng-controller="brandController" ng-init="findAll()">

<!-- .box-body -->
<div class="box-header with-border">
    <h3 class="box-title">已背单词列表</h3>
</div>

<div class="box-body">

    <!-- 数据表格 -->
    <div class="table-box">

        <!--工具栏-->
        <div class="pull-left">
            <div class="form-group form-inline">
                <div class="btn-group">
                    <!-- <a href="add"> -->
                    <button type="button" class="btn btn-default" title="添加单词"
                            data-toggle="modal" data-target="#editModal" ng-click="entity={}">
                        <i class="fa fa-file-o"></i> 添加单词
                    </button>
                    <!-- </a> -->

                    <button type="button" class="btn btn-default" title="刷新"
                            onclick="window.location.reload();">
                        <i class="fa fa-refresh"></i> 刷新
                    </button>
                </div>
            </div>
        </div>

        <!--工具栏/-->
        <div class="box-tools pull-right">
            <div class="has-feedback">
                时间 : <input type="date" ng-model="searchEntity.date2" /> <input
                    type="button" value="查询" class="btn btn-info btn-sm"
                    ng-click="search(searchEntity.data2)" />
            </div>
        </div>
        <!--数据列表-->
        <table id="dataList"
               class="table table-bordered table-striped table-hover dataTable">
            <thead>
            <tr>
                <th class="" style="padding-right: 0px"><input id="selall"
                                                               type="checkbox" class="icheckbox_square-blue"></th>
                <th class="sorting_asc">单词名称</th>
                <th class="sorting">属性名称</th>
                <th class="sorting">单词翻译</th>
                <th class="sorting">时间</th>
                <!-- <th class="text-center">操作</th> -->
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="op in list" ng-if="op!=null">
                <td><input type="checkbox"></td>
                <td>{{op.word}}</td>
                <td>{{op.wordProperty}}</td>
                <td>{{op.description}}</td>
                <td>{{op.updateDate}}</td>

            </tr>
            </tbody>
        </table>
        <!--数据列表/-->

    </div>
    <!-- 数据表格 /-->

</div>
<!-- 编辑窗口 -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×</button>
                <h3 id="myModalLabel">新增单词</h3>
            </div>
            <div class="modal-body">
                <table class="table table-bordered table-striped" width="800px">
                    <tr>
                        <td>单词</td>
                        <td><input  ng-model="entity.word" placeholder="请输入单词" class="form-control" name="word" onpaste="return false" onblur="check()" id="word"><span id="aaa"></span></td>
                    </tr>
                    <tr>
                        <td>词性</td>
                        <td><input  ng-model="entity.wordProperty" placeholder="请输入词性" class="form-control" name="wordProperty"></td>
                    </tr>
                    <tr>
                        <td>翻译</td>
                        <td><input  ng-model="entity.description" placeholder="请输入翻译" class="form-control" name="description"></td>
                    </tr>
                </table>
            </div>
            <div class="modal-footer">
                <button class="btn btn-success" data-dismiss="modal"
                        aria-hidden="true" ng-click="save()">保存</button>
                <button class="btn btn-default" data-dismiss="modal"
                        aria-hidden="true">关闭</button>
            </div>
        </div>
    </div>
</div>

</body>
</html>